Byte endianess is an attribute of data storage and retrieval. Big endian data or variables may be stored in memory in opposite byte order from little endian data or variables. Little endian data may be stored with the least significant byte in the lowest memory byte address while big endian data may be stored with the most significant byte in the lowest memory byte address. Big and little endian variables having the same value may be identical in CPU registers but may have differing order in memory.
Source code that is written using one byte endianess convention may not be executed on a platform using another endianess convention without recognizing the differing order of how some data are stored in memory. The following C code provides an example:
{int i = 0x12345678;char c = *((char*)&i);}The “c” will be 0x12 if the code is compiled and run on a big endian architecture but the “c” will be 0x78 if the code is compiled and run on a little endian architecture. Thus, to execute code written in one endianess convention on a computer system platform of another endianess convention may require endian conversion. This can be difficult when, for example, the source code includes unions or casts a first pointer (which points to data consisting of multiple bytes) to a second pointer (which points to data consisting of a single byte). Pointers can create difficulties because some bi-endian compilers do not track byte order through pointers, such as void pointers, and do not produce diagnostics for potential byte order change through such pointers. Thus, pointers and the like can lead to unforeseen byte order incompatibilities.